shr.defineClass("shr.atsbill.AtsLeaveBillEditExt", shr.ats.AtsLeaveBillEdit, {

    initalizeDOM: function () {
        var _self = this;
        shr.atsbill.AtsLeaveBillEditExt.superClass.initalizeDOM.call(this);

        _self.monitorPersonF7();
		_self.initEmergencyContact();
    },
    /**
     * 监听请假单员工F7控件
     */
    monitorPersonF7: function(){
        var _self = this;
        if(_self.getOperateState() != "VIEW"){
            $("#entries_person").shrPromptBox("option", {
                onchange : function (e, value) {
                    if(value.current == null){
                        return;
                    }
                    var currentId = value.current.id;

                    _self.setEmergencyContact(currentId);
                    
                }
            });
        }

    },

    /**
     * 获取请假单员工的紧急联系人信息并显示到页面
     */
    setEmergencyContact: function (personId) {
        var _self = this;

       _self.remoteCallHandlerForEmergencyContact(personId);
    },
	
	initEmergencyContact: function () {
        var _self = this;

		var personId = $('#entries_person_el').val();
		
		_self.remoteCallHandlerForEmergencyContact(personId);
      
    },
	
	remoteCallHandlerForEmergencyContact: function(personId){
		var _slef = this;
		
		  _self.remoteCall({
            method: 'getEmergencyContactInfo',
            param: { personId: personId },
            success: function (res) {
                if(res != undefined){
                    info = res;
                    $('#entries_jjlxrxm').shrTextField('setValue',info.linkName);
                    $('#entries_jjlxrlxfs').shrTextField('setValue',info.linkTelNum);
                }
            }
        });
		
	},
	assistantAction:function(){
		var _slef=this;
		//进入到请假助手按钮
		//console.log("请假助手进来了");
		$('body').append(this.getAssistantDivHtml());
		_slef.reasonOnClick();
	}

	,getAssistantDivHtml: function() {		
	return ['<div id="assistant_div" class="modal hide fade">',
				'<div class="modal-header">',
					'<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>',
					'<h5>请假助手</h5>',
				'</div>',
				'<div id="assistant-content"  class="modal-body">',
				'</div>',
			'</div>'].join('');
	},
	
	
	reasonOnClick: function() {
		this.remoteCall({
			method:'passValue',
			success:function(data){
				var b=data;
				if(b.holidaySystem!=undefined){
					$('#assistant-content').html(b.holidaySystem);	
				}
			}
		})	
		$('#assistant_div').modal('show');
	}


});